package actions.demo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;
/**
 * @author wanhong.gu
 */
public class StrutsSelectDemoAction extends Action {
    /**
     * @param pMapping to set
     * @param pForm to set
     * @param pRequest to set
     * @param pResponse to set
     * @return action forward
     * @throws Exception any exception
     */
    public ActionForward execute(ActionMapping pMapping, ActionForm pForm,
            HttpServletRequest pRequest, HttpServletResponse pResponse)
            throws Exception {
        DynaValidatorForm form = (DynaValidatorForm) pForm;
        pRequest.setAttribute("SELECT_PROPERTY_ONE",form.getString("selectPropertyOne"));
        pRequest.setAttribute("SELECT_PROPERTY_TWO",form.getString("selectPropertyTwo"));
        pRequest.setAttribute("SINGLE_SELECT",form.getString("singleSelect"));
        pRequest.setAttribute("MULTIPLE_SELECT",form.getStrings("multipleSelect"));
        return pMapping.getInputForward();
    }
}
